import {ecs} from "db://oops-framework/libs/ecs/ECS";
import {HideDatingComp} from "db://assets/script/game/dating/comp/hideDatingComp";
import {ShowDatingComp} from "db://assets/script/game/dating/comp/showDatingComp";
import {RestoreDeskComp} from "db://assets/script/game/dating/comp/restoreDeskComp";

@ecs.register("DatingEntity")
export class DatingEntity extends ecs.Entity {
    protected init() {
    }

    // 隐藏大厅
    hide() {
        if (!this.has(HideDatingComp)) {
            this.add(HideDatingComp)
        }
    }

    // 大厅允许点击
    show() {
        if (!this.add(ShowDatingComp)) {
            this.add(ShowDatingComp)
        }
    }

    // 还原房间
    restoreDesk(reconnect: boolean) {
        const comp = new RestoreDeskComp()
        comp.reconnect = reconnect
        this.add(comp)
    }
}